import pandas as pd  # 将pandas作为第三方库导入，我们一般为pandas取一个别名叫做pd

pd.set_option('expand_frame_repr', False)  # 当列太多时清楚展示

df = pd.read_csv(
    filepath_or_buffer=r'../../data/a_stock_201903.csv',
    encoding='gbk'
)

# 筛选数据
# print(df['股票代码'] == 'sh600000')  # 判断交易股票代码是否等于sh600000
# print(df[df['股票代码'] == 'sh600000'])  # 将判断为True的输出：选取股票代码等于sh600000的行
# print(df[df['股票代码'] == 'sh600000'].index)  # 输出判断为True的行的index
# print(df[df['股票代码'].isin(['sh600000','sh600004','sz000001'])])
# print(df[df['收盘价'] < 5.0])  # 选取收盘价小于10的行
print(df[(df['收盘价'] < 20.0) & (df['股票代码'] == 'sh600000')])  # 两个条件，或者的话就是|
